import xadmin
from .models import CityDict, CourseOrg, Teacher


class CityDictAdmin(object):
    list_display = ["name", "desc", "add_time"]
    search_fields = ["name", "desc"]
    list_filter = ["name", "desc", "add_time"]


class CourseOrgAdmin(object):
    list_display = ["name", "desc", "click_nums", "fav_nums", "image", "address", "city"]
    search_fields = ["name", "desc", "click_nums", "fav_nums", "image", "address", "city"]
    list_filter = ["name", "desc", "click_nums", "fav_nums", "image", "address", "city"]


class TeacherAdmin(object):
    """
        org = models.ForeignKey(CourseOrg, verbose_name="所属机构", on_delete=models.CASCADE)
        name = models.CharField(max_length=50, verbose_name="教师名")
        work_years = models.IntegerField(default=0, verbose_name="工作年限")
        work_company = models.CharField(max_length=50, verbose_name="就职公司")
        work_position = models.CharField(max_length=50, verbose_name="公司职位")
        points = models.CharField(max_length=100, verbose_name="教学特点")
        fav_nums = models.IntegerField(default=0, verbose_name="收藏数")
        click_nums = models.IntegerField(default=0, verbose_name="点击数")
        add_time = models.DateTimeField(default=datetime.now)
    """
    list_display = ["org", "name", "work_years", "work_company", "work_position", "points", "fav_nums",
                    "click_nums", "add_time"]
    search_fields = ["org", "name", "work_years", "work_company", "work_position", "points", "fav_nums",
                     "click_nums"]
    list_filter = ["org", "name", "work_years", "work_company", "work_position", "points", "fav_nums",
                   "click_nums", "add_time"]


xadmin.site.register(CityDict, CityDictAdmin)
xadmin.site.register(CourseOrg, CourseOrgAdmin)
xadmin.site.register(Teacher, TeacherAdmin)
